<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>yukari world</title>
<#include "/lib/base_source.ftl">
<style type="text/css">
</style>
</head>
<body>
<div class='whole-container'>
<#include "/lib/header.ftl">
    <div>
        <ul class="breadcrumb">
        	<li>夏季巡演</li><span class="divider">/</span>
            <li>二维码验证</li>
        </ul>
    </div>
    <div class="container-fluid">
        <div class="row-fluid">
            <div class="container span12">
            <#include "/lib/alert.ftl">

                <div class='main-content'>
                    <div class="well form-horizontal">

                        <div class="control-group">
                            <label class="control-label">场次</label>
                            <div class="controls">
                                <select name="city" id="city">
                                    <option value="chengdu" >成都</option>
                                    <option value="beijing" >北京</option>
                                    <option value="guangzhou" >广州</option>
                                    <option value="shanghai">上海</option>
                                </select>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">二维码</label>
                            <div class="controls">
                                <input id="ticket" type="text" name="ticket" value="" onchange="checkQr()"/>
                            </div>
                        </div>
                        <div class='main-action'>
                            <label class="control-label"></label>
                            <div class="controls">
                                <a class="btn btn-sm btn-info" href="javascript:" onclick="checkQr();">校验</a>
                            </div>
                        </div>
                    </div>

                    <div class="table-content" id="content">
                    <#-- table -->


                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>

    $(document).ready(function(){
    });

    function checkQr(){
        var city = $("#city").val();
        var ticket = $("#ticket").val();
        if (ticket == ""){
            $("#ticket").focus();
            return;
        }
        $.ajax({
            url : "${rc.contextPath}/admin/tour/checkQr",
            dataType : "json",
            data : {"ticket":ticket,"city":city},
            type:'post',
            success:function(json){
                var div = $('<div class="alert"></div>');
                if (json.code == 0){
                    var data = json.data;
                    var txt = data.name +" , ";
                    if (data.phone){
                        txt = txt + "手机号: "+data.phone+", ";
                    }
                    txt = txt+"校验成功";
                    div.html(txt);
                    div.addClass("alert-success")
                } else {
                    div.html(json.message);
                    div.addClass("alert-danger")
                }
                $("#content").prepend(div);
                $("#ticket").val("");
                $("#ticket").focus();
            }
        });
    }


</script>
</body>
</html>